package com.kino.sms.controller;

import com.kino.sms.entity.Bill;
import com.kino.sms.mapper.BillMapper;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 周伟忠
 * @date 2021年04月2021/4/28日 21:26
 */
@RestController
public class BillController {

    private final BillMapper mapper;

    public BillController(BillMapper mapper) {
        this.mapper = mapper;
    }

    @PostMapping("/insert")
    public ResponseEntity<Integer> insert(@RequestBody Bill bill) {
        return ResponseEntity.ok(mapper.insert(bill));
    }

    @GetMapping("/selectList")
    public ResponseEntity<List<Bill>> selectList() {
        return ResponseEntity.ok(mapper.selectList(null));
    }
}
